package com.jf.yytgd.interceptor;

import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.lang.NonNull;
import org.springframework.web.servlet.HandlerInterceptor;

/**
 * Created with IntelliJ IDEA
 * Description: 用户拦截器, 拦截为登录用户的非法操作
 * User:22954
 * Date:2025-01-15
 * Time:14:36
 */
public class UserInterceptor implements HandlerInterceptor {
    @Override
    public boolean preHandle(HttpServletRequest request, @NonNull HttpServletResponse response, @NonNull Object handler) throws Exception {
        return request.getSession().getAttribute("user") != null && HandlerInterceptor.super.preHandle(request, response, handler);
    }
}
